import request from '@/utils/request'

export function getReleaseAssets(params) {
  return request({
    url: '/ops/digitalAssets/releaseList',
    method: 'get',
    params: {userId: params}
  })
}

export function getDigitalAssetsPurchasedList(params) {
  return request({
    url: '/ops/digitalAssets/purchasedList',
    method: 'get',
    params: {userId: params}
  })
}

export function wxpay(id) {
  return request({
    url: '/ops/digitalAssets/wxPay',
    method: 'get',
    params: {id: id}
  })
}

export function checkPay(id) {
  return request({
    url: '/ops/digitalAssets/checkPay',
    method: 'get',
    params: {id: id}
  })
}

export function addTransactionRecord(data) {
  return request({
    url: '/ops/assetsTransaction/add',
    method: 'post',
    data
  })
}

export function payAssetsTransaction(data) {
  return request({
    url: '/ops/assetsTransaction/update',
    method: 'post',
    data
  })
}

export function getTransactionList(params) {
  return request({
    url: '/ops/assetsTransaction/transactionList',
    method: 'get',
    params: {userId: params}
  })
}

export function getTransactionDetailList(params) {
  return request({
    url: '/ops/assetsTransaction/getById',
    method: 'get',
    params: {id: params}
  })
}

export function getTransactionByOrderId(params) {
  return request({
    url: '/ops/assetsTransaction/getByOrderId',
    method: 'get',
    params: {orderId: params}
  })
}

export function getAssetsByIds(params) {
  return request({
    url: '/ops/digitalAssets/getByIds',
    method: 'get',
    params: {ids: params}
  })
}

export function getAssetsCategory(params) {
  return request({
    url: '/ops/category/complexSearchList',
    method: 'get',
    params: {tenantId: params}
  })
}

export function getCategoryTreeList(type, tenantId) {
  return request({
    url: '/ops/category/treeList',
    method: 'get',
    params: {type: type, tenantId: tenantId}
  })
}

export function getBuyCategoryTreeList(type, tenantId) {
  return request({
    url: '/ops/category/buyTreeList',
    method: 'get',
    params: {type: type, tenantId: tenantId}
  })
}

export function getAllUserAssets(params) {
  return request({
    url: '/ops/operateDigitalAssets/allUserAssets',
    method: 'get',
    params: {userId: params}
  })
}

export function updateAssets(data) {
  return request({
    url: '/ops/operateDigitalAssets/update',
    method: 'post',
    data
  })
}

export function splitDigitalAssets(data) {
  return request({
    url: '/ops/operateDigitalAssets/split',
    method: 'post',
    data
  })
}

export function deleteAssets(params) {
  return request({
    url: '/ops/operateDigitalAssets/delById',
    method: 'get',
    params: {id: params}
  })
}

export function getAssetsStage(params) {
  return request({
    url: '/ops/assetsStage/getAssetsStageList',
    method: 'get',
    params: {digitalAssetsId: params}
  })
}

export function delStageAndRelation(params) {
  return request({
    url: '/ops/assetsStage/delById',
    method: 'get',
    params: {id: params}
  })
}

export function getAssetsUnitAllList(params) {
  return request({
    url: '/ops/assetsUnit/getAssetsUnitListByUserId',
    method: 'get',
    params: {userId: params}
  })
}

export function getUserSelfAssetsUnitList(params) {
  return request({
    url: '/ops/assetsUnit/getUserSelfAssetsUnitListByUserId',
    method: 'get',
    params: {userId: params}
  })
}

export function getBuyAssetsUnitList(params) {
  return request({
    url: '/ops/assetsUnit/getBuyAssetsUnitListByUserId',
    method: 'get',
    params: {userId: params}
  })
}

export function deleteAssetsById(params) {
  return request({
    url: '/ops/assetsUnit/delById',
    method: 'get',
    params: {id: params}
  })
}

export function addDigitalAssets(data) {
  return request({
    url: '/ops/operateDigitalAssets/add',
    method: 'post',
    data
  })
}

export function getShoppingCar(params) {
  return request({
    url: '/ops/shoppingCar/getByTenantId',
    method: 'get',
    params: {tenantId: params}
  })
}

export function getShoppingCarItemByRelationId(params) {
  return request({
    url: '/ops/shoppingCarItem/getByShoppingCarId',
    method: 'get',
    params: {shoppingCarId: params}
  })
}

export function deleteShoppingCarItemById(params) {
  return request({
    url: '/ops/shoppingCarItem/delById',
    method: 'get',
    params: {id: params}
  })
}

export function addShoppingCarItem(data) {
  return request({
    url: '/ops/shoppingCarItem/add',
    method: 'post',
    data
  })
}

export function delShoppingCarItems(params) {
  return request({
    url: '/ops/shoppingCarItem/delByRelationId',
    method: 'get',
    params: {shoppingCarId: params}
  })
}

export function createOrder(data) {
  return request({
    url: '/ops/order/add',
    method: 'post',
    data
  })
}

export function getOrderById(params) {
  return request({
    url: '/ops/order/getOrderById',
    method: 'get',
    params: {id: params}
  })
}

export function updateOrder(data) {
  return request({
    url: '/ops/order/update',
    method: 'post',
    data
  })
}

export function getOrderDetail(params) {
  return request({
    url: '/ops/orderDetail/getOrderDetailsByOrderId',
    method: 'get',
    params: {orderId: params}
  })
}

export function alipayTrade(params) {
  return request({
    url: '/ops/order/tradePay',
    method: 'get',
    params: {
      orderCode: params.orderCode,
      totalPrice: params.totalPrice,
      orderName: params.orderName,
      description: params.description,
      tenantId: params.tenantId
    }
  })
}

export function getAssetsList(params) {
  return request({
    url: '/ops/assets/getOrderDetailsByOrderId',
    method: 'get',
    params: {orderId: params}
  })
}

export function getEnclosureList(params) {
  return request({
    url: '/ops/assetsUnit/getEnclosureByAssetsId',
    method: 'get',
    params: {assetsId: params}
  })
}

export function delEnclosureById(id, url) {
  return request({
    url: '/ops/assetsUnit/delEnclosureById',
    method: 'get',
    params: {id: id, url: url}
  })
}

export function addAssetsUnit(data) {
  return request({
    url: '/ops/assetsUnit/addAssetsUnit',
    method: 'post',
    data
  })
}

export function updateAssetsUnit(data) {
  return request({
    url: '/ops/assetsUnit/updateAssetsUnit',
    method: 'post',
    data
  })
}

export function upLoadFileToOss(data) {
  return request({
    url: '/ops/assetsUnit/addFileToOss',
    method: 'post',
    data
  })
}

export function getCreateUploadVideoUrl(data) {
  return request({
    url: '/ops/assetsUnit/getCreateUploadVideoUrl',
    method: 'post',
    data
  })
}

export function getRefreshUploadVideoInfo(videoId) {
  return request({
    url: '/ops/assetsUnit/getRefreshUploadVideoInfo',
    method: 'get',
    params: {videoId: videoId}
  })
}

export function addEnclosureFromVideo(data) {
  return request({
    url: '/ops/assetsUnit/addEnclosureFromVideo',
    method: 'post',
    data
  })
}

export function showPercent(data) {
  return request({
    url: '/ops/assetsUnit/showPercent',
    method: 'post',
    data
  })
}

export function clearPercent(data) {
  return request({
    url: '/ops/assetsUnit/clearPercent',
    method: 'post',
    data
  })
}

export function saveUsedRecord(data) {
  return request({
    url: '/ops/assetsUnit/saveUsedRecord',
    method: 'post',
    data
  })
}
